//
//  CGQxiangmuGuanliCell.swift
//  SheYangBigData
//
//  Created by 叁拾叁 on 2021/4/8.
//  Copyright © 2021 叁拾叁. All rights reserved.
//

import UIKit


class CGQxiangmuGuanliCell: SYBaseCell {

    var bgView: UIView = {
        let v = UIView()
        v.backgroundColor = .white
        v.layer.masksToBounds = true
        v.layer.cornerRadius = 5.autoWidth()
        return v
    }()
    let title: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 14.autoBoldFontSize()
        v.text = "设备离线"
        return v
    }()
    
    let content: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x666666)
        v.font = 15.autoFontSize()
        v.text = "设备离线"
        return v
    }()
    
    var sepView: UIView = {
        let v = UIView()
        v.backgroundColor = Constant.bgViewColor
        return v
    }()
    
    public func configureView(model: CGQyuweiModel) {
//        title.text = model.name
//        if let p = model.imgPath {
//            pic.kf.setImage(with: URL(string: IMGIP+p))
//        }
    }
    
    public func configureView(model: CGQxiangmuDetailModel, row: Int ) {
//        title.text = model.name
//        if let p = model.imgPath {
//            pic.kf.setImage(with: URL(string: IMGIP+p))
//        }
        
      
        switch row {
        
        case 0:
            title.text = "项目名称"
            content.text = model.appName ?? "暂无内容"
            content.numberOfLines = 0 

        case 1:
            title.text = "APPID"
            sepView.backgroundColor = UIColor(hex: 0xF0F0F0)
            content.text = model.appId ?? "暂无内容"
            
        case 2:
            title.text = "公司名称"
            sepView.backgroundColor = Constant.bgViewColor
            content.text = model.companyName ?? "暂无内容"
            
        case 3:
            title.text = "备注"
            sepView.backgroundColor = Constant.bgViewColor
            content.text = model.remarks ?? "暂无内容"
            
            
        default:break

            
        }
    }
    
    
    override func initViews() {
      
        
        
        self.backgroundColor = Constant.bgViewColor
        addSubview(bgView)

        addSubview(sepView)
        bgView.addSubview(title)
        bgView.addSubview(content)
        bgView.addSubview(lineView)
        
        bgView.snp.makeConstraints { (make) in
            
            make.left.equalToSuperview().offset(15.autoWidth())
            make.right.equalToSuperview().offset(-15.autoWidth())
            make.bottom.equalToSuperview().offset(0)
            make.top.equalTo(sepView.snp.bottom).offset(0)
        }
        sepView.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.height.equalTo(10.autoWidth())
            make.top.equalToSuperview()
        }
        title.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(autoWidth(23))
            make.left.equalToSuperview().offset(autoWidth(10))
            make.right.equalToSuperview().offset(autoWidth(-10.0))
            make.height.equalTo(14.autoWidth())
        }
        
        content.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(autoWidth(65))
            make.left.equalToSuperview().offset(autoWidth(10))
            make.right.equalToSuperview().offset(autoWidth(-10.0))
            make.height.greaterThanOrEqualTo(15.autoWidth())
            make.bottom.equalToSuperview().offset(-15.autoWidth())
        }
        
        lineView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(autoWidth(50))
            make.left.equalToSuperview()
            make.right.equalToSuperview()
            make.height.equalTo(0.5.autoWidth())
        }
    }
}
